<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <meta charset="UTF-8">
    <title>用户注册</title>
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.validate.min.js"></script>
    <script src="js/messages_zh.js"></script>
    <script>
        $().ready(function () {
            $("#signupForm").validate({
                rules: {
                    username: "required",
                    password: {
                        required: true,
                        minlength: 6
                    },
                    email: {
                        required: true,
                        email: true
                    },
                    mobile: {
                        required: true,
                        number: true,
                        rangelength: [11, 11]
                    },
                    confirm: {
                        required: true,
                        equalTo: "#password"
                    }
                },
                messages:{
                    username:"用户名不能为空",
                    password: {
                        required:"密码不能为空",
                        minlength:"密码至少是6位"
                    },
                    email: {
                        required:"邮箱不能为空",
                        email:"邮箱格式有误"
                    },
                    mobile:{
                        required:"手机号不能为空",
                        number:"手机号必须为数字",
                        rangelength:"手机号必须为11位"
                    }
                }

            });

        });


    </script>
    <style>
        .error{
            color:red;
        }
    </style>
</head>
<body>
<div class="container-fluid mt-3 d-block ">
    <div class="card m-auto d-flex w-25 bg-light">
        <div class="card-img m-auto d-flex"><img class="m-auto img-thumbnail" src="img/user.png"></div>
        <div class="card-title m-auto d-flex ">用户注册</div>
        <form id="signupForm" method="get" class="m-auto" action="signup">
            <div class="form-group">
                <label>用户名</label>
                <input class="form-control" type="text" name="username">
            </div>
            <div class="form-group">
                <lable>手机号</lable>
                <input class="form-control" type="text" name="mobile">
            </div>
            <div class="form-group">
                <lable>邮箱</lable>
                <input class="form-control" type="text" name="email">
            </div>
            <div class="form-group">
                <lable>地址</lable>
                <input class="form-control" type="text" name="address">
            </div>
            <div class="form-group">
                <lable>密码</lable>
                <input class="form-control" type="password" name="password" id="password">
            </div>
            <div class="form-group">
                <lable>再次输入密码</lable>
                <input class="form-control" type="password" name="confirm" id="confirm">
            </div>

            <button id="submit" class="btn bg-primary" type="submit" >注册</button>
            <a class="btn btn-danger" href="login.jsp">已有账号前往登录</a>

        </form>
    </div>
</div>
</body>
</html>